import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
//写操作(字节流)
public class Demo_7 {
    public static void main(String[] args) {

        //清空写
        try(OutputStream outputStream = new FileOutputStream("./AAA.txt")){//默认会将文件中的东西清空,再写入
            byte[] buffer = new byte[]{'a','c','f'};
            outputStream.write(buffer);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

        //追加写
        try(OutputStream outputStream1 = new FileOutputStream("./AAA1.txt",true)){
            byte[] buffer = new byte[]{'a','c','f'};
            outputStream1.write(buffer);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
